<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="LProjectDelayApply" xmlns="http://ibatis.apache.org/mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<alias>
    <typeAlias alias="LProjectDelayApply" type="EIA.PM.Model.LProjectDelayApply, EIA.PM.Model" />
</alias>

<resultMaps>
<resultMap id="select-lprojectdelayapply-result" class="LProjectDelayApply">
<constructor>
    <argument argumentName="dly_id" column="dly_id"/>
    <argument argumentName="prj_id" column="prj_id"/>
    <argument argumentName="orginal_scheduled" column="orginal_scheduled"/>
    <argument argumentName="dly_days" column="dly_days"/>
    <argument argumentName="dly_des" column="dly_des"/>
    <argument argumentName="approve_state" column="approve_state"/>
    <argument argumentName="approve_content" column="approve_content"/>
    <argument argumentName="approve_date" column="approve_date"/>
    <argument argumentName="approve_staff" column="approve_staff"/>
    <argument argumentName="_date" column="_date"/>
    <argument argumentName="_staff" column="_staff"/>
</constructor>
<!--
    <result property="DlyId" column="dly_id"/>
    <result property="PrjId" column="prj_id"/>
    <result property="OrginalScheduled" column="orginal_scheduled"/>
    <result property="DlyDays" column="dly_days"/>
    <result property="DlyDes" column="dly_des"/>
    <result property="ApproveState" column="approve_state"/>
    <result property="ApproveContent" column="approve_content"/>
    <result property="ApproveDate" column="approve_date"/>
    <result property="ApproveStaff" column="approve_staff"/>
    <result property="Date" column="_date"/>
    <result property="Staff" column="_staff"/>
-->
</resultMap>
</resultMaps>

<statements>
<sql id="sql_LProjectDelayApply_where_pk">
WHERE dly_id=#DlyId#
</sql>

<sql id="sql_LProjectDelayApply_where_cv">
<dynamic prepend="WHERE">
    <isPropertyAvailable property="DlyId" prepend="AND">dly_id=#DlyId#</isPropertyAvailable>
    <isPropertyAvailable property="PrjId" prepend="AND">prj_id=#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="OrginalScheduled" prepend="AND">orginal_scheduled=#OrginalScheduled#</isPropertyAvailable>
    <isPropertyAvailable property="DlyDays" prepend="AND">dly_days=#DlyDays#</isPropertyAvailable>
    <isPropertyAvailable property="DlyDes" prepend="AND">dly_des LIKE concat('%', #DlyDes#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="ApproveState" prepend="AND">approve_state=#ApproveState#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveContent" prepend="AND">approve_content LIKE concat('%', #ApproveContent#, '%')</isPropertyAvailable>
    <isPropertyAvailable property="ApproveDate" prepend="AND">approve_date=#ApproveDate#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveStaff" prepend="AND">approve_staff=#ApproveStaff#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend="AND">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend="AND">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<sql id="sql_LProjectDelayApply_set_cols">
<dynamic prepend="SET">
    <isPropertyAvailable property="PrjId" prepend=",">prj_id=#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="OrginalScheduled" prepend=",">orginal_scheduled=#OrginalScheduled#</isPropertyAvailable>
    <isPropertyAvailable property="DlyDays" prepend=",">dly_days=#DlyDays#</isPropertyAvailable>
    <isPropertyAvailable property="DlyDes" prepend=",">dly_des=#DlyDes#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveState" prepend=",">approve_state=#ApproveState#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveContent" prepend=",">approve_content=#ApproveContent#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveDate" prepend=",">approve_date=#ApproveDate#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveStaff" prepend=",">approve_staff=#ApproveStaff#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date=#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff=#Staff#</isPropertyAvailable>
</dynamic>
</sql>

<select id="SelectLProjectDelayApply" parameterClass="" resultMap="LProjectDelayApply.select-lprojectdelayapply-result">
SELECT *
FROM l_project_delay_apply
<include refid="sql_LProjectDelayApply_where_pk"/><!--where-->
</select>

<select id="SelectLProjectDelayApply_CV" parameterClass="System.Collections.IDictionary" resultMap="LProjectDelayApply.select-lprojectdelayapply-result">
SELECT *
FROM l_project_delay_apply
<include refid="sql_LProjectDelayApply_where_cv"/><!--where-->
</select>

<insert id="InsertLProjectDelayApply" parameterClass="LProjectDelayApply">
<!--pre selectKey place-->
INSERT INTO l_project_delay_apply(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">prj_id</isPropertyAvailable>
    <isPropertyAvailable property="OrginalScheduled" prepend=",">orginal_scheduled</isPropertyAvailable>
    <isPropertyAvailable property="DlyDays" prepend=",">dly_days</isPropertyAvailable>
    <isPropertyAvailable property="DlyDes" prepend=",">dly_des</isPropertyAvailable>
    <isPropertyAvailable property="ApproveState" prepend=",">approve_state</isPropertyAvailable>
    <isPropertyAvailable property="ApproveContent" prepend=",">approve_content</isPropertyAvailable>
    <isPropertyAvailable property="ApproveDate" prepend=",">approve_date</isPropertyAvailable>
    <isPropertyAvailable property="ApproveStaff" prepend=",">approve_staff</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">_date</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">_staff</isPropertyAvailable>
</dynamic>
)VALUES(
<dynamic prepend=" ">
    <isPropertyAvailable property="PrjId" prepend=",">#PrjId#</isPropertyAvailable>
    <isPropertyAvailable property="OrginalScheduled" prepend=",">#OrginalScheduled#</isPropertyAvailable>
    <isPropertyAvailable property="DlyDays" prepend=",">#DlyDays#</isPropertyAvailable>
    <isPropertyAvailable property="DlyDes" prepend=",">#DlyDes#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveState" prepend=",">#ApproveState#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveContent" prepend=",">#ApproveContent#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveDate" prepend=",">#ApproveDate#</isPropertyAvailable>
    <isPropertyAvailable property="ApproveStaff" prepend=",">#ApproveStaff#</isPropertyAvailable>
    <isPropertyAvailable property="Date" prepend=",">#Date#</isPropertyAvailable>
    <isPropertyAvailable property="Staff" prepend=",">#Staff#</isPropertyAvailable>
</dynamic>
)
<selectKey resultClass="int" type="post" property="DlyId" >
SELECT LAST_INSERT_ID()
</selectKey>
</insert>

<update id="UpdateLProjectDelayApply" parameterClass="System.Collections.IDictionary">
UPDATE l_project_delay_apply
<include refid="sql_LProjectDelayApply_set_cols"/><!--set-->
<include refid="sql_LProjectDelayApply_where_pk"/><!--where-->
</update>

<delete id="DeleteLProjectDelayApply" parameterClass="">
DELETE FROM l_project_delay_apply
<include refid="sql_LProjectDelayApply_where_pk"/><!--where-->
</delete>

<statement id="DeleteLProjectDelayApply_CV" parameterClass="LProjectDelayApply">
DELETE FROM l_project_delay_apply
<include refid="sql_LProjectDelayApply_where_cv"/><!--where-->
</statement>

<delete id="ClearLProjectDelayApply">
DELETE FROM l_project_delay_apply
</delete>
</statements>
</sqlMap>